/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import com.anhdt.dao.MyServletJspOrEjb;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Anh Dinh
 */
public class SayHello extends BaseService {

  
    @Override
    public void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        try (PrintWriter out = response.getWriter()) {
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>SayHello</title>");            
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Hello " + request.getParameter("name") + "</h1>");
            out.println("</body>");
            out.println("</html>");
        }
    }

    
     @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            getX();
        } catch (Exception ex) {
            Logger.getLogger(SayHello.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    protected void getX() throws Exception{
        MyServletJspOrEjb test = new MyServletJspOrEjb();
        test.doSomething();
    }

}
